<?php

namespace App\Http\Requests;
/**
 * 用户注册验证器
 * @package App\Http\Requests
 */
class ApiUserRegisterPost extends ApiBaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required',
            'email' => 'required|email',
            'password' => 'required',
            'c_password' => 'required|same:password',
        ];
    }

    /**
     * 定义错误提示
     * @return array
     */
    public function messages()
    {
        return [
            'name.required' => '请输入注册用户名',
            'email.required' => '请输入注册邮箱',
            'email.email' => '邮箱格式不正确',
            'password.required' => '密码不能为空',
            'c_password.required' => '重复密码不能为空',
            'c_password.same' => '两次密码输入不一致',
        ];
    }
}
